import React from 'react';
import { UnorderedListOutlined, PartitionOutlined, TeamOutlined } from '@ant-design/icons';

const UserList = React.lazy(() => import(/* webpackChunkName: "UserList" */ '@/pages/auth/build-in-test-sys/user-list'));
const RoleList = React.lazy(() => import(/* webpackChunkName: "RoleList" */ '@/pages/auth/build-in-test-sys/role-list'));
const RoleDetails = React.lazy(() => import(/* webpackChunkName: "RoleDetails" */ '@/pages/auth/build-in-test-sys/role-details'));
const RoleDetailsForId = React.lazy(() => import(/* webpackChunkName: "RoleDetailsForId" */ '@/pages/auth/build-in-test-sys/role-details-for-id'));
const RoleDetailsInDetails = React.lazy(() => import(/* webpackChunkName: "RoleDetailsInDetails" */ '@/pages/auth/build-in-test-sys/role-details-in-details'));
const RoleInfo01 = React.lazy(() => import(/* webpackChunkName: "RoleInfo01" */ '@/pages/auth/build-in-test-sys/role-info-01'));
const RoleInfo02 = React.lazy(() => import(/* webpackChunkName: "RoleInfo02" */ '@/pages/auth/build-in-test-sys/role-info-02'));

// 资源码映射表
// 命名规范 appname_modulename:menu:function
// 路由配置，包含菜单
export const sysManagementRouteMenuStructuredData: PermItem = {
    permsKey: 'app_sys:manage:dire01',
    name: '系统管理',
    //组件名称
    needValid: true,
    icon: PartitionOutlined,
    children: [
        {
            permsKey: 'app_sys:manage:dire02',
            name: '系统管理02',
            needValid: true,
            icon: PartitionOutlined,
            children: [
                {
                    permsKey: 'app_sys:user:query',
                    path: '/auth/userList',
                    name: '用户列表',
                    component: UserList,
                    icon: UnorderedListOutlined,
                    needValid: true,
                },
                {
                    permsKey: 'app_sys:role:query',
                    path: '/auth/roleList',
                    name: '角色列表',
                    icon: TeamOutlined,
                    component: RoleList,
                    needValid: true,
                    //这里是路由的层级
                    children: [
                        {
                            permsKey: 'app_sys:role:inof01',
                            path: '/auth/roleList/info01',
                            showOnMenu: false,
                            needValid: false,
                            component: RoleInfo01,
                        },
                        {
                            permsKey: 'app_sys:role:inof02',
                            path: '/auth/roleList/info02',
                            showOnMenu: false,
                            needValid: false,
                            component: RoleInfo02,
                        },
                    ],
                },
                {
                    permsKey: 'app_sys:role:details',
                    name: '角色详情',
                    path: '/auth/roleList/details',
                    showOnMenu: false,
                    needValid: false,
                    component: RoleDetails,
                },
                {
                    permsKey: 'app_sys:role:idDetails',
                    name: '我是动态Id的角色详情',
                    path: '/auth/roleList/:id',
                    showOnMenu: false,
                    needValid: false,
                    component: RoleDetailsForId,
                },
                {
                    permsKey: 'app_sys:role:detailsInDetails',
                    name: '角色详情里面的详情也',
                    path: '/auth/roleList/detailsInDetails',
                    showOnMenu: false,
                    needValid: false,
                    component: RoleDetailsInDetails,
                },
            ],
        },
    ],
};

export const sysManagementBtnsPerm: Record<string, PermItem> = {
    'app_sys:manage:btn001': {
        desc: '测试定义按钮001',
    },
    'app_sys:manage:btn002': {
        desc: '测试定义按钮002',
    },
};
